package co.yixiang.modules.system.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * @author seven
 * @Package co.yixiang.modules.system.enums
 * @date 2020/8/29 11:07
 */
@Getter
@AllArgsConstructor
public enum OrderStatusEnum {


    /**
     * 1、未支付
     */

    AWAIT(1, "1", "未支付"),

    /**
     * 9、已支付
     */
    DONE(9, "9", "已支付"),

    /**
     * 5、支付失败
     */
    FAIL(5, "5", "支付失败"),

    /**
     * 6.实体卡购买
     */
    OFFICE_PAYMENTS(6, "6", "实体卡购买"),
    /**
     * 7. 合伙人赠送
     */
    SHARE(7, "7", "合伙人赠送权益卡"),
    /**
     * 3、已退款
     */
    REFUND(3, "3", "已退款");


    private Integer intValue;

    private String value;

    private String desc;

    public static OrderStatusEnum toType(String value) {
        return Stream.of(OrderStatusEnum.values())
                .filter(p -> p.value.equals(value))
                .findAny()
                .orElse(null);
    }

    public static OrderStatusEnum toType(Integer intValue) {
        return Stream.of(OrderStatusEnum.values())
                .filter(p -> p.intValue.equals(intValue))
                .findAny()
                .orElse(null);
    }

    public String value() {
        return this.value;
    }

    public Integer intValue() {
        return this.intValue;
    }

    public String desc() {
        return this.desc;
    }
}
